<?php

//print_r($menu_list);

?>



<div class="box">
  <div class="hd">网站导航管理 &darr;</div>
  <div class="bd"> 
    <!-- <div class="ctrl"><a href="#" title="添加导航">添加导航</a></div> -->
    <table class="itbale">
      <tr class="t">
        <td>菜单显示名称</td>
        <td>菜单类型</td>
        <td>banner图片</td>
        <td>点击banner链接</td>
        <td>序号</td>
        <td>对应程序中控制器</td>
        <td>操作</td>
      </tr>
      
      <?php 
			foreach($menu_list as $key=>$val){
              $del_url=site_url("admin/menu_manag/del_menu/{$val["id"]}"); 
              $base_url=base_url();
              $thum_url= $base_url."/uploads/banner/thum";
                echo "<tr>
            	<td><strong>{$val["name"]}</strong></td>
                <td>{$val["type"]}</td>
                <td><img src=\"{$thum_url}/{$val["banner"]}\" height=\"100\"/></td>
                 <td>{$val["banner_url"]}</td>
                  <td>{$val["morder"]}</td>
                      <td>{$val["controller_name"]}</td>
                <td><a href=\"{$del_url}\">删除</a> | ".anchor('admin/menu_manag/edit_menu/'.$val["id"],'编辑','class="edit"')."</td>
            </tr>";
            } 
      ?>
     
    </table>
  </div>
</div>


<div class="box">
  <div class="hd">添加导航 &darr;</div>
  <div class="bd">
    <form action="<?php
            echo site_url("admin/menu_manag/add_menu");
            ?>" method="post" enctype="multipart/form-data">
      <table class="formtable">
        <tr>
          <th>导航名称</th>
          <td><input type="text" size="30" name="name" /></td>
        </tr>
        <tr>
          <th>菜单类型</th>
          <!-- 类型 -->
          <td><select name="type" id="type">
              <?php 
                    //print_r($menu_type_array);
                    foreach($menu_type_array as $key=>$val){
                        
                        echo "<option value =\"{$val}\">{$key}</option>";
                        
                    }
                    //echo form_dropdown('bannerurl',array('0'=>'单页','1'=>'有实际内容的页'),0);
                    
                    
                    ?>
            </select></td>
        </tr>
        <tr>
          <th>Banner</th>
          <td><input type="file" size="30" name="banner" /></td>
        </tr>
        <tr>
          <th>Banner链接</th>
          <td><input type="text" size="30" name="bannerurl" /></td>
        </tr>
        <tr>
          <th>内容</th>
          <td><script type="text/javascript">
					bkLib.onDomLoaded(function() {
						new nicEditor({fullPanel:true,iconsPath:'<?php echo base_url("nicEdit");?>/nicEditorIcons.gif'}).panelInstance('content');
					});
					</script>
            <textarea rows="15" cols="90" name="content" id="content"></textarea></td>
        </tr>
        <tr>
          <th>顺序</th>
          <td><input type="text" size="5" name="order" /></td>
        </tr>
        <tr>
          <th><input  id ="controller_name"  name="controller_name" type="hidden" value=""></th>
          <td><input type="submit" name="add_submit" value="确定创建" /></td>
        </tr>
      </table>
    </form>
  </div>
</div>


<script type="text/javascript">
$(document).ready(function(){
	var value = $("#type").find("option:selected").text() ;
 	$("#controller_name").val(value);

	 $("#type").change(function(){     
		 var value=$(this).find("option:selected").text() ;   
		 $("#controller_name").val(value);
	 }); 
});
</script>
